package starter.db;

import java.sql.Connection;
import java.util.List;

import starter.context.App;

import com.bowlong.sql.SqlEx;

// 维护修复数据表
public class RepairDB {
	public static void repairAllTables() {
		try (Connection conn = App.ds().getConnection();) {
			List<String> tables = SqlEx.getTableNames(conn);
			for (String TABLENAME2 : tables) {
				{
					String sql = SqlEx.Mysql.getRepairSql(TABLENAME2);
					System.out.println(sql);
					SqlEx.execute(conn, sql);
				}
				// {
				// String sql = SqlEx.Mysql.getOptimizeSql(TABLENAME2);
				// System.out.println(sql);
				// SqlEx.execute(conn, sql);
				// }
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		repairAllTables();
	}
}
